package com.xhji.spider.webmagic.pipeline;

import com.xhji.spider.entity.PageDetail;
import com.xhji.spider.mapper.PageDetailMapper;
import org.springframework.stereotype.Component;
import us.codecraft.webmagic.ResultItems;
import us.codecraft.webmagic.Task;
import us.codecraft.webmagic.pipeline.Pipeline;

import javax.annotation.Resource;

@Component
public class PageDetailCommonPipeline implements Pipeline {

    @Resource
    private PageDetailMapper pageDetailMapper;

    @Override
    public void process(ResultItems resultItems, Task task) {
        PageDetail pageDetail = (PageDetail)resultItems.get("pageDetail");
        pageDetailMapper.insert(pageDetail);
    }
}
